Mailhog   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

2 Functions

Rating   Name   Duplication   Size   Complexity  
A configure 0 5 1
A addNginxConfiguration 0 3 1
1
import * as fs from 'fs'
2
import nginxMailhogConf from '../templates/nginx/mailhog'
3
import {getConfig, jaleNginxAppsPath} from '../utils/jale'
4
import Nginx from './nginx'
5
import Service from './service'
6
7
class Mailhog extends Service {
8
    service = 'mailhog'
9
10
11
    nginxConfigPath = `${jaleNginxAppsPath}/mailhog.conf`
12
13
    configure = async (): Promise<boolean> => {
14
        await this.addNginxConfiguration()
15
        await (new Nginx).restart()
16
17
        return true
18
    }
19
20
    /**
21
     * Install the Mailhog Nginx configuration.
22
     */
23
    addNginxConfiguration = async (): Promise<void> => {
24
        const config = await getConfig()
25
        return fs.writeFileSync(this.nginxConfigPath, nginxMailhogConf(config.tld))
26
    }
27
28
}
29
30
export default Mailhog
31